<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
	<title> Jypbook - Home </title>
	<link rel="stylesheet" type="text/css" href="style/repertoire.css">
</head>

<body class="fbbody">



<?php

if (session_id()=="") session_start();
require_once("db.class.php");
require_once("check.php");
$db = new DB;
if(isset($_GET['p']) && $_GET['p']==0) $_SESSION['logged']=0;
if(!isset($_SESSION['logged'])) $_SESSION['logged']=0;
if(isset($_POST['val_connecte'])) {
	$_SESSION['logged']=checkID(
	$_POST["c1"],$_POST["c2"]);
}



if (!$_SESSION['logged']) {
	
	$_SESSION["info"] = NULL;
	require("connecte.php");
}
else{
	
	if (isset($_GET['page'])){
	$page = $_GET['page'];
	}else{
	$page='profil';
	}
	
	if(isset($_POST['val_connecte'])) {
		$_SESSION["id"]=$_POST["c1"];
		require_once("session.php");
		$S=new Session();
		$_SESSION["info"] = $S->Get_info($_SESSION["id"]);
	}
	
	require("topbar.php");
	
	if(isset($_POST['searchfriend'])) {
		$page ='searchresult';
		$friendname = $_POST['friendname'];
	}
	if(isset($_POST['editprofile'])) {
		$page ='editprofile';
	}
	if(isset($_POST['editprofile']) OR isset($_POST['cancel'])) {
		$page ='editprofile';
	}
	require($page.".php");

}
?>

</body>
</html>
